﻿/***********************************************************************
 * <copyright file="DepartmentEntity.cs" company="BUCA JSC">
 * -->    Copyright (C) statement. All right reserved
 * </copyright>
 * 
 * Created:   ThangND
 * Email:    thangnd@buca.vn
 * Website:
 * Create Date: 07 March 2014
 * Usage: 
 * 
 * RevisionHistory: 
 * Date         Author               Description 
 * 
 * ************************************************************************/


using BusinessObjects.BusinessRules;

namespace BusinessObjects.BussinessDictionary
{
    /// <summary>
    /// DepartmentEntity
    /// </summary>
    public class Department : BusinessObject 
    {
        /// <summary>
        /// </summary>
        public Department()
        {
            //validateId
            AddRule(new ValidateId("DepartmentId"));
            //validateRequired
            AddRule(new ValidateRequired("UnitId"));
            AddRule(new ValidateRequired("Code"));
            AddRule(new ValidateRequired("Name"));
            //validateLength
            AddRule(new ValidateLength("Code", 0, 20));
        }

        /// <summary>
        /// </summary>
        /// <param name="departmentId"></param>
        /// <param name="parentId"></param>
        /// <param name="code"></param>
        /// <param name="name"></param>
        /// <param name="unitId"></param>
        /// <param name="address"></param>
        /// <param name="phoneNumber"></param>
        /// <param name="fax"></param>
        /// <param name="description"></param>
        /// <param name="isActive"></param>
        public Department(long departmentId, int? parentId, string code, string name, long unitId, string address,
                          string phoneNumber, string fax, string description, bool isActive)
            : this()
        {
            DepartmentId = departmentId;
            UnitId = unitId;
            Code = code;
            Name = name;
            Address = address;
            Description = description;
            IsActive = isActive;
            Fax = fax;
            PhoneNumber = phoneNumber;
            ParentId = parentId;
        }

        /// <summary>
        /// </summary>
        public long DepartmentId { get; set; }

        /// <summary>
        /// </summary>
        public int? ParentId { get; set; }

        /// <summary>
        /// </summary>
        public string Code { get; set; }

        /// <summary>
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// </summary>
        public long UnitId { get; set; }

        /// <summary>
        /// </summary>
        public string Address { get; set; }

        /// <summary>
        /// </summary>
        public string PhoneNumber { get; set; }

        /// <summary>
        /// </summary>
        public string Fax { get; set; }

        /// <summary>
        /// </summary>
        public string Description { get; set; }

        /// <summary>
        /// </summary>
        public bool IsActive { get; set; }
    }
}